<template>
  <header class="header">
      <h1>任务列表</h1>
      <input class="new-todo" placeholder="请输入要做的事情" autofocus @keyup.enter="add" v-model.trim="todu"/>
    </header>
</template>

<script>
export default {
    data() {
      return {
        todu: ''
      }
    },
    methods: {
      add () {
        // console.log(this.todu)
        this.$emit('add', this.todu)
        this.todu = ''    //  清空输入框
    }
  }
}
</script>

<style>

</style>